import hyRequest from '..'
import type { IAccount, IUserResponse } from './type'
// import { localCache } from '@/utils/cache'
// import { LOGIN_TOKEN } from '@/global/constant'

// 获取登陆用户token
export function accountLoginRequest(IAccount: IAccount) {
  return hyRequest.post<any>({
    url: '/login',
    data: IAccount
  })
}

// 获取用户详细信息
export function getUserInfoById(id: number) {
  return hyRequest.get<IUserResponse>({
    url: `/users/${id}`
    // 携带token方式
    /* headers: {
      Authorization: localCache.getCache(LOGIN_TOKEN)
    } */
  })
}

// 根据角色id获取菜单
export function getUserMenuByRoleId(id: number) {
  return hyRequest.get<any>({
    url: `/role/${id}/menu`
  })
}
